package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Payments;


public class PaymentsDao extends IbatisDao{
	
	public List selectPayments() throws SQLException {
		List selectPayments = null;
		selectPayments =getSqlMap().queryForList("SELECT_ALL_PAYMENTS", null);
		return selectPayments;
	}

	public int deletePayments(Payments payments) throws SQLException{
		return (int) getSqlMap().delete("DELETE_PAYMENTS", payments);
	}
	
	public int updatePayments(Payments payments) throws SQLException{
		return (int) getSqlMap().update("UPDATE_PAYMENTS", payments);
	}
	
	public Payments insertPayments(Payments payments) throws SQLException{
		return (Payments) getSqlMap().insert("INSERT_PAYMENTS", payments);
	}
	
		
	public static void main (String args[]) throws SQLException{
		Payments payments;
		/*List<Payments> paymentss;
		
		payments.setPayId(143);
		paymentss = new PaymentsDao().selectPayments();*/
		//System.out.println(paymentss.size());
		payments = new Payments();
		//payments.setCardName("apa");
		payments.setPayId(2);
		new PaymentsDao().deletePayments(payments);
		
		//new PaymentsDao().insertPayments(payments); 
		//System.out.println("Payments dengan ID "+ payments.getPayId()+ " telah di insert pada DB");
		
		//payments = new PaymentsDao().selectPayments(1); 
		//System.out.println("Vendor dengan nama ="+vendor.getName()+ " ,telah di dapat pada dari DB dengan id ="+ vendor.getVendorID());
		
	}
	
}